import { DerviceHttp } from "@/utils/request"
import http from "@/utils/request"

// 获取设备 Token
export function getDerviceToken() {
    return DerviceHttp({
        method: 'post',
        url:'/Dervice/v2/user/login?group=51trace',
        data: {
            user_name:'15610501500',
            password: '123456'
        }
    });
}

// 获取设备列表
export function getDerviceList() {
    return DerviceHttp({
        method: 'get',
        url:'/Dervice/room/1933/device_chunk/list',
    });
}

// 获取每个设备的详细信息
export function getDerviceInfo(devId, dateType, timeType) {
    return http({
        url: `/breed/InternetEquipment/EnvirMonGraphDataHistory/${devId}/${dateType}/${timeType}`,
        method: 'get'
    });
}
// export function getDerviceInfo(id) {
//     return DerviceHttp({
//         method: 'get',
//         url: `/Dervice/device_chunk/${id}`
//     })
// }

// 获取设备采集到的数据
export function getDerviceData(id, start_time, stop_time, time_interval, parameterUnitKey) {
    return DerviceHttp({
        method: 'get',
        url: `/Dervice/v2/device_chunk/${id}/${parameterUnitKey}?start_time=${start_time}&stop_time=${stop_time}&time_interval=${time_interval}`
    })
}

// 获取当前参数和时间
export function getCurrentParameter(id) {
    return DerviceHttp({
        method: 'get',
        url: `/Dervice/device_chunk/${id}/sensor_data/end`
    })
}